<template>
  <div>
    <video 
      autoplay
      loop
      muted>
      <source 
        src="https://cdn.duonadian.com/videoq.mp4" 
        type="video/mp4">
    </video>
    <div class="home-content">
      <div>
        <h1
          v-show="showText" 
          class="show-tip">
          多拿点商城</h1>
        <h4
          v-show="showDnd"
          class="show-tip">新零售社交电商平台，以优质服务为用户做到自买自省，分享赚钱！</h4>
        <img
          v-show="showC"
          class="show"
          src="~/static/img/web_bg_triangle.png">
      </div>
    </div>
    <div
      v-show="showIcon"
      class="wx-minxi" 
      @mouseenter="enter"
      @mouseleave="leave">
      <img src="~/static/img/web_home_xiaochengxu.png">
    </div>
    <div
      v-show="show"
      class="show-hover">
      <div class="show-top">
        <img src="~/static/img/web_logo_yellow.png">
        <div>
          <h2>多拿点</h2>
          <h4>多赚不止一点点!</h4>
        </div>
      </div>
      <img 
        class="erp" 
        src="~/static/img/wx.png">
      <p>微信扫码登录</p>
    </div>
    <div
      v-show="showIcon"
      class="home-more"
      @click="nextPage">
      <img src="~/static/img/web_home_more.png">
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      fadeClass: '',
      show: false,
      showIcon: false,
      showText: false,
      showDnd: false,
      showC: false
    }
  },
  mounted() {
    this.timer = setTimeout(() => {
      this.fadeClass = 'animated fadeIn'
    }, 800)
    this.time = setTimeout(() => {
      this.showIcon = true
    }, 2500)
    setTimeout(() => {
      this.showDnd = true
      this.showC = true
    }, 3000)
    setTimeout(() => {
      this.showText = true
    }, 2800)
  },
  destroyed() {
    clearTimeout(this.timer)
    this.timer = null
  },
  methods: {
    enter() {
      this.show = true
    },
    leave() {
      this.show = false
    },
    nextPage() {
      this.$emit('nextPage')
    }
  }
}
</script>

<style lang="scss" scoped>
@media screen and (min-width: 1920px) {
  .home-mobile {
    width: 42rem !important;
    bottom: -8rem !important;
  }
}
@media screen and (max-width: 1024px) {
  .wx-minxi {
    width: 4rem;
    height: 4rem;
    background-color: #f8e71c;
    border-radius: 0.5rem;
    position: absolute;
    padding: 1rem;
    left: 3rem !important;
    bottom: 4rem;
    img {
      width: 2rem;
      height: 2rem;
    }
  }
}
.home-content {
  width: 100%;
  height: 100%;
  top: 0;
  position: absolute;
  text-align: center;
  color: #ffffff;
  padding-top: 20%;
  .active {
    animation: zoomIn 3.5s;
  }
  h1 {
    font-size: 5rem;
    font-weight: bold;
    opacity: 0.9;
  }
  h4 {
    font-size: 1.9rem;
    margin-top: 2rem;
    font-weight: 400;
    color: #ffffff;
  }
  .show {
    margin-left: 20%;
    position: absolute;
  }
}
.show-tip {
  animation: tip 4s;
}
@keyframes tip {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
.wx-minxi {
  width: 4rem;
  height: 4rem;
  background-color: #f8e71c;
  border-radius: 0.5rem;
  position: absolute;
  padding: 1rem;
  left: 12rem;
  bottom: 4rem;
  img {
    width: 2rem;
    height: 2rem;
  }
}
video {
  width: 100%;
  height: 100%;
}
.show-hover {
  width: 16rem;
  height: 22rem;
  border-radius: 1rem;
  background-color: #ffffff;
  position: absolute;
  bottom: 14rem;
  left: 12rem;
  .show-top {
    padding: 2rem;
    display: flex;
    align-items: center;
    img {
      width: 4rem;
      margin-right: 1rem;
    }
    div {
      display: inline-block;
      h2 {
        width: 4rem;
        height: 1.83rem;
        font-size: 1.33rem;
        font-family: PingFangSC-Medium;
        font-weight: 500;
        color: black;
        line-height: 1.83rem;
      }
      h4 {
        width: 6.67rem;
        height: 1.17rem;
        font-size: 0.83rem;
        font-family: PingFangSC-Regular;
        font-weight: 400;
        color: #a1a1a1;
        line-height: 1.17rem;
      }
    }
  }
  .erp {
    width: 10rem;
    height: 10rem;
    margin: 0 3rem;
  }
  p {
    margin-top: 1rem;
    text-align: center;
    padding: 0;
    height: 1.67rem;
    font-size: 1.17rem;
    font-family: PingFangSC-Regular;
    font-weight: 400;
    color: #5f5f5f;
    line-height: 1.67rem;
  }
}
.home-more {
  position: absolute;
  bottom: 5rem;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 4.42rem;
  height: 2.5rem;
  padding: 2rem;
  img {
    width: 4rem;
  }
}
</style>
